<html>
<head><meta charset="utf-8"><title>disarming specialization · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html">disarming specialization</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="187307276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187307276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187307276">(Feb 03 2020 at 21:38)</a>:</h4>
<p>FWIW I'm working on adding checks for specializations in the compiler.</p>



<a name="187307281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187307281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187307281">(Feb 03 2020 at 21:38)</a>:</h4>
<p>I've also opened <a href="https://github.com/rust-lang/rust/issues/68358" target="_blank" title="https://github.com/rust-lang/rust/issues/68358">#68358</a> to remove the unsound and weaponizable impls</p>



<a name="187307835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187307835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187307835">(Feb 03 2020 at 21:43)</a>:</h4>
<p>By which I mean specializing on non-marker traits.</p>



<a name="187310428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187310428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187310428">(Feb 03 2020 at 22:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> that's perfect timing :P</p>



<a name="187498144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187498144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187498144">(Feb 05 2020 at 21:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> what sorts of checks are you working on?</p>



<a name="187498153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187498153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187498153">(Feb 05 2020 at 21:43)</a>:</h4>
<p>maybe let's move that to another zulip topic, actually</p>



<a name="187498592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187498592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187498592">(Feb 05 2020 at 21:48)</a>:</h4>
<p>The goal was to ensure that all specialising impls are always applicable. There were some compromises so that all the impls in libstd (except those removed in the linked PR) are allowed.</p>



<a name="187498996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187498996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187498996">(Feb 05 2020 at 21:53)</a>:</h4>
<p>To allow the required impls, I had to consider the bounds from the specialized impl. I also had to whitelist some marker traits (via attribute) as being ok to specialize on (this is unsound for traits other than Sized, but can't be exploited in the same way as traits with items).</p>



<a name="187499250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187499250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187499250">(Feb 05 2020 at 21:56)</a>:</h4>
<p>I'm unsure if we can keep all of the TrustedRandomAccess  impls that we currently have.</p>



<a name="187508755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187508755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187508755">(Feb 06 2020 at 00:08)</a>:</h4>
<blockquote>
<p>To allow the required impls, I had to consider the bounds from the specialized impl. I also had to whitelist some marker traits (via attribute) as being ok to specialize on (this is unsound for traits other than Sized, but can't be exploited in the same way as traits with items).</p>
</blockquote>
<p>this is kind of the "more advanced" variant of "always applicable" that I initially proposed?</p>



<a name="187733130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/disarming%20specialization/near/187733130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/disarming.20specialization.html#187733130">(Feb 08 2020 at 22:02)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/68970" target="_blank" title="https://github.com/rust-lang/rust/issues/68970">#68970</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>